<template>
  <div class='login_page'>
    <div class='login_modules'>
      <!-- logo -->
      <div class='logo'>
        <i class='iconfont icon-blogger'/>
      </div>
      <!-- 登录/注册 选择按钮 -->
      <div class='select_way'>
        <a href='#' :class='{pitch_on:selectWayShow}' @click='selectWayShow=true'>登录</a>
        <a href='#' :class='{pitch_on:!selectWayShow}' @click='selectWayShow=false'>注册</a>
      </div>
      <!-- 账号/密码 输入框 -->
      <div class='form_page'>
        <loginform v-if='selectWayShow' @closeLogin='closeLoginPage'/>
        <registerform v-else @closeLogin='closeLoginPage'/>
      </div>
      <!-- 关闭按钮 -->
      <span class='close' @click='closeLoginPage'><i class='iconfont icon-guanbi'/></span>
    </div>
  </div>
</template>

<script>

  import loginform from './loginForm'
  import registerform from './registerForm'

  export default {
    components: {
      loginform,
      registerform
    },
    data() {
      return {
        selectWayShow:true,
      }
    },
    methods:{
      closeLoginPage() {
        this.$emit('closeLogin')
      }
    }
  }
</script>

<style scoped>
.login_page {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.5);
}
.login_page .login_modules {
  width: 350px;
  height: 450px;
  border-radius: 8px;
  background: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  overflow: hidden;
}
.logo {
  width: 100%;
  height: 30%;
  text-align: center;
  padding-top: 50px;
  box-sizing: border-box;
}
.logo>i {
  color: #333;
  font-size: 60px;
}
.login_modules {
  width: 100%;
  height: 20px;
}
.select_way {
  width: 100%;
  height: 30px;
  display: flex;
}
.select_way>a {
  flex: 1;
  text-align: center;
  line-height: 30px;
  text-decoration: none;
  color: #333;
}
.pitch_on {
  border-bottom: 1px solid #397;
}
.form_page {
  width: 100%;
  margin-top: 10px;
}
.close {
  position: absolute;
  top: 15px;
  right: 15px;
  transition: all 0.8s;
  cursor: pointer;
}
.close>i {
  font-size: 16px;
  color: #333;
}
.close:hover {
  transform: rotate(180deg)
}
</style>
